﻿<div style="padding: 1px; overflow: hidden">
    <form id="ui_dead_editform" method="post" >
        <div title="编辑死者信息" style="padding: 10px">
            <table style="width: 99%">
                <tr>
                    <th style="background-color: #cccccc" colspan="4">逝者信息</th>
                </tr>
                <tr>
                    <th rowspan="5" style="text-align: center">遗像<br />
                        (小于1M):</th>
                    <td rowspan="5">
                        <div style="width: 120px; height: 120px; border: solid 1px gray">
                            <img id="ui_dead_photo_img" alt="死者遗像" src="/admin/images/dead.jpg" style="width: 120px; height: 120px;" />

                        </div>
                        <input type="hidden" name="ui_dead_photo" value="/admin/images/dead.jpg" id="ui_dead_photo" />
                        <br />
                        <input type="file" name="ui_upload_photo_file" id="ui_upload_photo_file" onchange="uploadImage()" />
                    </td>

                    <th>姓名:
                        <input type="hidden" name="ui_dead_id" id="ui_dead_id" />
                        <input type="hidden" name="ui_relative_id" id="ui_dead_relative_id" />                       
                    </th>
                    <td>
                        <input class="easyui-textbox" type="text" name="ui_dead_name" id="ui_dead_name" data-options="required:true" />

                    </td>
                </tr>
                <tr>

                    <th>性别:</th>

                    <td>
                        <select class="easyui-combobox" name="ui_dead_gender" id="ui_dead_gender" data-options="panelHeight:70,editable:false">
                            <option value="男">男</option>
                            <option value="女">女</option>
                            <option value="未知">未知</option>
                        </select>
                    </td>                  
                </tr>
                <tr>
                    <th>民族:</th>
                    <td>
                        <select class="easyui-combobox" name="ui_dead_nation" id="ui_dead_nation" data-options="editable:false">
                            <option value="汉族" selected="selected">汉族</option>
                            <option value="蒙古族">蒙古族</option>
                            <option value="回族">回族</option>
                            <option value="藏族">藏族</option>
                            <option value="维吾尔族">维吾尔族</option>
                            <option value="维吾尔族">维吾尔族</option>
                            <option value="苗族">苗族</option>
                            <option value="彝族">彝族</option>
                            <option value="壮族">壮族</option>
                            <option value="布依族">布依族</option>
                            <option value="朝鲜族">朝鲜族</option>
                            <option value="满族">满族</option>
                            <option value="侗族">侗族</option>
                            <option value="瑶族">瑶族</option>
                            <option value="白族">白族</option>
                            <option value="土家族">土家族</option>
                            <option value="哈尼族">哈尼族</option>
                            <option value="哈萨克族">哈萨克族</option>
                            <option value="傣族">傣族</option>
                            <option value="黎族">黎族</option>
                            <option value="傈僳族">傈僳族</option>
                            <option value="佤族">佤族</option>
                            <option value="畲族">畲族</option>
                            <option value="高山族">高山族</option>
                            <option value="拉祜族">拉祜族</option>
                            <option value="水族">水族</option>
                            <option value="东乡族">东乡族</option>
                            <option value="纳西族">纳西族</option>
                            <option value="景颇族">景颇族</option>
                            <option value="柯尔克孜族">柯尔克孜族</option>
                            <option value="土族">土族</option>
                            <option value="达斡尔族">达斡尔族</option>
                            <option value="仫佬族">仫佬族</option>
                            <option value="羌族">羌族</option>
                            <option value="布朗族">布朗族</option>
                            <option value="撒拉族">撒拉族</option>
                            <option value="毛南族">毛南族</option>
                            <option value="仡佬族">仡佬族</option>
                            <option value="锡伯族">锡伯族</option>
                            <option value="阿昌族">阿昌族</option>
                            <option value="普米族">普米族</option>
                            <option value="塔吉克族">塔吉克族</option>
                            <option value="怒族">怒族</option>
                            <option value="乌孜别克族">乌孜别克族</option>
                            <option value="俄罗斯族">俄罗斯族</option>
                            <option value="鄂温克族">鄂温克族</option>
                            <option value="德昂族">德昂族</option>
                            <option value="保安族">保安族</option>
                            <option value="裕固族">裕固族</option>
                            <option value="京族">京族</option>
                            <option value="塔塔尔族">塔塔尔族</option>
                            <option value="独龙族">独龙族</option>
                            <option value="鄂伦春族">鄂伦春族</option>
                            <option value="赫哲族">赫哲族</option>
                            <option value="门巴族">门巴族</option>
                            <option value="珞巴族">珞巴族</option>
                            <option value="基诺族">基诺族</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th>所属地区:</th>
                    <td>
                        <input class="easyui-combotree" id="ui_dead_areaId" name="ui_dead_areaId"
                            data-options="url:'ashx/bg_area.ashx?action=getall', lines:true,required:true" />
                    </td>
                </tr>
                <tr>
                    <th>详细地址:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_dead_homeAddress" id="ui_dead_homeAddress" data-options="required:true"  style="width: 95%" />
                    </td>
                </tr>
                <tr>
                    <th>证件类型</th>
                    <td>
                        <select class="easyui-combobox" name="ui_dead_cardtype" id="ui_dead_cardtype" data-options="panelHeight:90,editable:false">
                            <option value="身份证">身份证</option>
                            <option value="军官证">军官证</option>
                            <option value="警官证">警官证</option>
                            <option value="其他证件">其他证件</option>
                        </select>
                    </td>
                    <th>证件号码:</th>
                    <td>
                        <input class="easyui-textbox" type="text" name="ui_dead_cardno" id="ui_dead_cardno" data-options="required:false" />

                    </td>
                </tr>

                <tr>
                    <th>火化时间:</th>
                    <td>
                        <input class="easyui-datebox" id="ui_dead_firetime" name="ui_dead_firetime" data-options="required:false" /></td>
                    <th>死亡时间:</th>
                    <td>
                        <input class="easyui-datetimebox" id="ui_dead_deathtime" name="ui_dead_deathtime" data-options="required:false" />
                    </td>
                </tr>
                <tr>
                    <th>职业:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_dead_profession" id="ui_dead_profession" />
                    </td>
                    <th>文化程度:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_dead_education" id="ui_dead_education" />
                    </td>
                </tr>
                <tr>
                    <th>死亡原因:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_dead_deathcause" id="ui_dead_deathcause" />
                    </td>
                    <th>死亡地点:</th>
                    <td>
                        <input class="easyui-textbox" name="ui_dead_deathplace" id="ui_dead_deathplace" />
                    </td>
                </tr>
                
                <tr>
                    <th>出生地址:</th>
                    <td colspan="3">
                        <input class="easyui-textbox" name="ui_dead_birAddress" id="ui_dead_birAddress" style="width: 95%" />
                        
                    </td>
                </tr>                                
               
            </table>
        </div>
    </form>
    <script>
        //$(function () {
        //    $('#ui_relative_tel').textbox({
        //        icons: [{
        //            iconCls: 'icon-search',
        //            handler: function (e) {
        //                var tel = $(e.data.target).textbox('getValue');
        //                getRelativeByTel(tel)
        //            }
        //        }]
        //    });

        //    $("#ui_relative_tel").find('input').bind('keyup', function (ev) {
        //        alert(ev.target);
        //        if (ev.keyCode == '13') {
        //            //处理回车，不生效？？？？               
        //        }
        //    });
        //});

        function getRelativeByTel(tel) {
            if (!tel) {
                $.show_warning("提示", "请输入联系人电话！");
                return;
            }
            para = {};
            para.action = "getRelativeByTel";
            para.timespan = new Date().getTime();
            para.tel = tel;
            $.ajax({
                url: "ashx/bg_relative.ashx",
                data: para,
                type: "POST",
                dataType: "json",
                success: function (data) {
                    var dr = data.msg;
                    if (data.success && dr) {
                        $('#ui_relative_id').val(dr.id);
                        $('#ui_relative_name').textbox('setValue', dr.name);
                        $('#ui_relative_tel').textbox('setValue', dr.tel);
                        $('#ui_relative_relation').textbox('setValue', dr.relation);
                        $('#ui_relative_cardno').textbox('setValue', dr.cardno);
                        $('#ui_relative_addr').textbox('setValue', dr.addr);
                        $('#ui_relative_company').textbox('setValue', dr.company);
                        $('#ui_relative_title').textbox('setValue', dr.title);
                    } else if (dr) {
                        $.show_warning("提示", data.msg);
                    } else {
                        $.show_warning("提示", "获取信息失败，当前身份证号的人不存在！");
                    }
                }
            });
        }
        function uploadImage() {            
            var v = $("#ui_upload_photo_file").val();           
            //判断是否选择图片  
            if (v == null || v == "") {
                $.messager.alert('提示', '请选择图片!');
                $("#ui_upload_photo_file").focus();
                return;
            }
            var options = {
                type: "POST",
                url: 'ashx/upload_image.ashx',
                success: function (data) {                   
                    var res = eval('(' + data + ')');    //转成json格式
                    if (res.success) {
                        $('#ui_dead_photo_img').attr('src', res.content);
                        $('#ui_dead_photo').val(res.content);
                        //$.messager.alert('提示', '上传成功！');
                    } else {
                        $.messager.alert('提示', res.content);
                    }
                }
            };
            // 将options传给ajaxForm  
            $('#ui_dead_editform').ajaxSubmit(options);
        }
    </script>
</div>
